The present invention relates to USB data acquisition (DAQ) systems, and particularly to a virtual FIFO implementation which emulates a hardware device for improved USB data acquisition performance.
Scientists and engineers often use DAQ systems to perform a variety of functions, including laboratory research, process monitoring and control, data logging, analytical chemistry, test and analysis of physical phenomena, and control of mechanical or electrical machinery, to name a few examples.
A typical DAQ system comprises a computer system with DAQ hardware, wherein the DAQ hardware is typically plugged into one of the I/O slots of the computer system. A DAQ system also typically includes transducers and other detecting means for providing xe2x80x9cfieldxe2x80x9d electrical signals representing a process, physical phenomena, equipment being monitored or measured, etc. The field signals are provided to the DAQ hardware. In another common DAQ system configuration, the DAQ hardware is coupled to the computer system via other means such as through a VXI (VME extensions for Instrumentation) bus, a GPIB (General Purpose Interface Bus), a serial port, or parallel port of the computer system. Optionally, the DAQ system includes signal conditioning modules which receive the field signals and condition the signals to be acquired.
The DAQ hardware is configured and controlled by DAQ software executing on the computer system. The DAQ software for configuring and controlling the DAQ system typically comprises two portions: the device interface or driver level software and the application software, or the application. The driver level software serves to interface the DAQ hardware to the application. The driver level software is typically supplied by the manufacturer of the DAQ hardware or by some other third party software vendor. An example of DAQ driver level software is NI-DAQ from National Instruments Corporation. The application or client is typically developed by the user of the DAQ system and is tailored to the particular function which the user intends the DAQ system to perform. The DAQ hardware manufacturer or third party software vendor sometimes supplies the application software for certain applications which are common, generic or straightforward.
The Universal Serial Bus is a serial peripheral bus standard developed for computer system peripheral devices. The USB is an external serial bus which supports data exchange between a host computer and a wide range of peripheral devices. The USB provides two wire, point-to-point signaling in which the signals are differentially driven at a bit rate of 12 megabits per second.
USB systems are generally defined in terms of (1) interconnects, (2) devices, and (3) hosts. The USB interconnect defines the manner in which the USB devices are connected to and communicate with the USB host. The host computer system USB interface is referred to as the host controller. The host controller may be implemented in a combination of hardware, firmware, or software. USB devices are defined as (1) hubs, which provide additional attachment points to the USB, or (2) functions, which provide capabilities to the system; e.g., an ISDN connection, a digital joystick, or speakers. Hubs indicate the attachment or removal of a USB device in its per port status bit. The host determines if a newly attached USB device is a hub or a function and assigns a unique USB address to the USB device. All USB devices are accessed by a unique USB address. Each device additionally supports one or more endpoints with which the host may communicate. The remaining description will be limited to USB devices defined as functions.
The USB supports functional data and control exchange between the USB host and USB devices. USB data transfers take place between host software and a particular endpoint on a USB device. The USB host, e.g., the host computer system, interacts with USB devices through the host controller. The host controller is responsible for detecting the attachment and removal of USB devices, managing control flow between the host and USB devices, managing data flow between the host and USB devices, collecting status and activity statistics, and providing a limited amount of power to attached USB devices. The USB system software on the host manages interactions between the USB devices and device software. Further background concerning the USB may be obtained from USB Specification, Revision 1.0 which is incorporated herein by reference.
In prior art systems, e.g., prior art instrumentation systems, the host CPU obtains data from a peripheral device, such as a data acquisition card, using either DMA transfers or interrupt driven requests. DMA transfers typically use burst transfers for improved performance. However, for interrupt driven requests, the host software is typically required to read one sample at a time. In other words, for interrupt drive requests, host software is typically configured to read data one sample at a time from a local peripheral device, e.g., from a PCI DAQ device.
DMA transfers are generally not possible for USB transfers between a host computer system and a USB device. Thus, for USB transfers, the host controller typically utilizes existing driver level software which operates to read or communicate data with the USB device one sample at a time. Thus, when this existing driver level software is used, the host controller is required to read data from a USB DAQ device one sample at a time.
However, due to the relatively slow transfer rates of the USB, a read of one sample at a time results in slow data transfer rates. For example, the time required to read 100,000 samples from the USB device would be no faster than 100,000 samples times 0.003 seconds/sample which equals 300 seconds, i.e., 333 samples per second. Thus, simple data acquisition tasks using a USB DAQ device take a very large amount of time. Alternatively, the existing driver level software can be modified to take advantage of USB packet transfers. However, this may require a large modification to existing software, which is undesirable.
Therefore, an improved system and method is desired which provides increased performance for USB devices. It is also desirable to improve the performance of USB devices with minimal impact on existing software and drivers.
The present invention comprises a system and method for performing data transfers in a data acquisition system comprising a computer system and a device coupled to the computer system through a serial bus. The serial bus is preferably the Universal Serial Bus (USB), and the device is preferably a USB DAQ device. The computer system includes device driver software, preferably DAQ driver level software, and serial bus driver software, preferably USB software. The computer system also includes virtual buffer software according to the present invention.
The virtual buffer software increases USB data transfer rates in the USB-based data acquisition system with minimal changes to DAQ driver level software. The virtual buffer software operates to receive or intercept calls made by the DAQ driver level software to acquire data from the device, wherein the DAQ driver level software is designed to read the data from the device one sample at a time from the device. The virtual buffer software intercepts the call and requests the data in bulk packets from the device.
The virtual buffer software then stores the received packets of data in a virtual buffer or virtual FIFO maintained in computer system memory. When a determined amount of data is stored in the virtual FIFO, the virtual buffer software generates an interrupt to the device driver software.
In response to the interrupt, a device driver software interrupt service routine executes to read a status register to determine a cause of the interrupt. The virtual buffer software intercepts the status register read operation and returns a status of the buffer portion of the computer memory which stores the data, wherein the status of the buffer portion of the computer memory reflects the data received from the device. The device driver software interrupt service routine then reads the data a sample at a time from the virtual FIFO in response to the interrupt and in response to the status of the buffer portion of the computer memory reflecting the data received from the device.
The DAQ driver level software thus obtains the data from the computer system memory using much faster transfers, e.g., up to 100,000 samples per second. The virtual buffer software emulates operation of the device, including generation of interrupts and responses to status register reads, thus xe2x80x9cfoolingxe2x80x9d the DAQ driver level software into thinking the data is being acquired from the device. Thus, the present invention allows for much faster data transfers, while requiring minimal or no changes to the existing DAQ driver level software.